home *** CD-ROM | disk | FTP | other *** search
- Path: news.spies.com!usenet
- From: Erik Max Francis <max@alcyone.com>
- Newsgroups: comp.lang.c++
- Subject: Re: How to initialize array of objects using non-void constructor?
- Date: Sun, 31 Mar 1996 20:39:47 -0800
- Organization: Alcyone Systems
- Message-ID: <315F5E13.799D1B33@alcyone.com>
- References: <4jbuo5$mcb@newshost.lanl.gov> <315C8F65.78D5@aai.arco.com>
- NNTP-Posting-Host: newton.alcyone.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
-
- Brian Leach wrote:
-
- > Liang Lu wrote:
- > >
- > > Example:
- > >
- > > class Table {
- > > Table() ;
- > > Table(int n) ;
- > > ..
- > > } ;
- > >
- > > Table object[10] ; // default constructor are used here
- >
- > Sorry Liang, it is not possible. The language does not allow for
- > non-default
- > constructors for arrays of objects.
-
- Nonsense; see Ellis & Stroustrup, 12.6.1. Using non-default constructors for
- initializing an array is much the same as one would expect (using the example
- above):
-
- Table object[3] = { object(1), object(1), object(2) };
-
- --
- Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
- San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
- H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
- Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
- "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
-